package view.panel.prompt
{
	import control.panel.AlertYesNoPanelControl;
	import control.panel.IPanelControl;
	
	import flash.events.MouseEvent;
	
	import view.components.ImgButton;
	
	public class AlertYesNoPanel extends AlertPanel
	{
		private var yesBut:ImgButton;
		private var noBut:ImgButton;
		
		public function AlertYesNoPanel(panelControl:IPanelControl)
		{
			super(panelControl);
			isAlert = true;
			initBut();
		}
		
		private function initBut():void
		{
			yesBut = new ImgButton(0,0,1,onBut,50,20,"butBg",null,"确定");
			noBut = new ImgButton(0,0,2,onBut,50,20,"butBg",null,"取消");
		}
		
		private function onBut(event:MouseEvent):void
		{
			if (event.target.id == 1)
			{
				(panelControl as AlertYesNoPanelControl).onYes();
			}
			else
			{
				(panelControl as AlertYesNoPanelControl).onNo();
			}
		}
		
		public function alertBut(content:String) : void
		{
			
			super.alert(content);
			//this.graphics.clear();
			yesBut.x = (hintText.width * .5) - (yesBut.width + 10);
			noBut.x = (hintText.width * .5) + 10;
			yesBut.y = noBut.y = hintText.y + hintText.height + 3;
			addChild(yesBut);
			addChild(noBut);
			resetBg(this.width,this.height+ 10,1,true);
			
		}
	}
}